package com.dai.consumer_feign31.feign;

import com.dai.com_api.entity.Dept;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

//采用feign接口式调用服务 “DAI-PROVIDER”这个服务下面挂着很多实例
//当调用这个接口的时候，会采用ribbon配置的负载均衡算法去调用本服务下面的具体实例

//定义要访问的服务
@FeignClient(value = "DAI-PROVIDER")
public interface DeptFeign {

    @RequestMapping("/dept/add")
    public boolean add(Dept dept);

    @RequestMapping(value = "/dept/get/{id}",method = RequestMethod.GET)
    public Dept get(@PathVariable("id") int id);

    @RequestMapping("/dept/list")
    public List<Dept> list();

}
